<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <rich:panel>
        <f:facet name="header">Person Details</f:facet>

        <s:decorate id="personid" template="layout/display.xhtml">
            <ui:define name="label">Personid</ui:define>
            <h:outputText value="#{personHome.instance.personid}">
                <f:convertNumber/>
            </h:outputText>
        </s:decorate>

        <s:decorate id="firstname" template="layout/display.xhtml">
            <ui:define name="label">Firstname</ui:define>
            <h:outputText value="#{personHome.instance.firstname}"/>
        </s:decorate>

        <s:decorate id="lastname" template="layout/display.xhtml">
            <ui:define name="label">Lastname</ui:define>
            <h:outputText value="#{personHome.instance.lastname}"/>
        </s:decorate>

        <s:decorate id="userpassword" template="layout/display.xhtml">
            <ui:define name="label">Userpassword</ui:define>
            <h:outputText value="#{personHome.instance.userpassword}"/>
        </s:decorate>

        <div style="clear:both"/>

    </rich:panel>

    <div class="actionButtons">

        <s:button view="/PersonEdit.xhtml"
                    id="edit"
                 value="Edit"/>

        <s:button view="/#{empty personFrom ? 'PersonList' : personFrom}.xhtml"
                    id="done"
                 value="Done"/>

    </div>

    <rich:tabPanel switchType="ajax">

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/onetomany.gif" style="vertical-align: middle; padding-right: 4px;"/>Timeentries</h:panelGroup>
        </f:facet>
    <h:form styleClass="association" id="timeentriesChildren">

        <h:outputText value="There are no timeentries associated with this person."
                   rendered="#{empty personHome.timeentries}"/>

        <rich:dataTable value="#{personHome.timeentries}"
                       var="_timeentry"
                  rendered="#{not empty personHome.timeentries}"
                rowClasses="rvgRowOne,rvgRowTwo"
                        id="timeentriesTable">
            <rich:column sortBy="#{_timeentry.timeentryid}">
                <f:facet name="header">Timeentryid</f:facet>
                <h:outputText value="#{_timeentry.timeentryid}">
                    <f:convertNumber/>
                </h:outputText>
            </rich:column>
            <rich:column sortBy="#{_timeentry.startdatetime}">
                <f:facet name="header">Startdatetime</f:facet>
                <h:outputText value="#{_timeentry.startdatetime}">
                    <s:convertDateTime type="date" dateStyle="short"/>
                </h:outputText>
            </rich:column>
            <rich:column sortBy="#{_timeentry.enddatetime}">
                <f:facet name="header">Enddatetime</f:facet>
                <h:outputText value="#{_timeentry.enddatetime}">
                    <s:convertDateTime type="date" dateStyle="short"/>
                </h:outputText>
            </rich:column>
            <h:column>
                <f:facet name="header">Action</f:facet>
                <s:link id="selecttimeentry"
                     value="Select"
                      view="/Timeentry.xhtml">
                    <f:param name="timeentryTimeentryid"
                            value="#{_timeentry.timeentryid}"/>
                    <f:param name="timeentryFrom" value="Person"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </h:form>

    <div class="actionButtons">
        <s:button
               value="Add timeentry"
                view="/TimeentryEdit.xhtml">
            <f:param name="personPersonid"
                    value="#{personHome.instance.personid}"/>
            <f:param name="timeentryFrom" value="Person"/>
        </s:button>
    </div>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
